#include "Bonus.h"
#include "Bomb.h"
#include "Position.h"
#include "Labyrinth.h"
#include "Constant.h"

#include <cstdlib>
#include <iostream>
#include <string>
#include <fstream>
#include <time.h>

using namespace std;

Bonus::Bonus(Position _position)
: bonusPosition(_position)
{
	cout << "bonus position:" << endl;
	bonusPosition.display();
}



void Bonus::initBonus(Labyrinth& labyrinth, Position bonusPosition)
{
	srand (time(NULL));
	int random = rand() % 100 + 1;
	//cout << random << endl;
	
	if (random <= 25)
	{
		//FIREUP &
		labyrinth.setElement(bonusPosition, FIREUP);
		cout << "&" << endl;
	}
	else if (random >= 26 && random <= 50)
	{
		//FIREDOWN !
		labyrinth.setElement(bonusPosition, FIREDOWN);
		cout << "!" << endl;
	}
	else if (random >= 51 && random <= 75)
	{
		//BOMBUP $
		labyrinth.setElement(bonusPosition, BOMBUP);
		cout << "$" << endl;
	}
	else if (random >= 76)
	{
		//BOMBDOWN *
		labyrinth.setElement(bonusPosition, BOMBDOWN);
		cout << "*" << endl;
	}
	else
	{
		cout << random << " chiffre invalide." << endl;
	}
	
}